<script setup lang="ts">
import { WatermarkProps } from "naive-ui";
import { useAppStore, useThemeStore } from "@scpun/stores";
import { computed } from "vue";
import { AppProvider } from "@scpun/components";

const appStore = useAppStore();
const themeStore = useThemeStore();
// 水印配置
const watermarkProps = computed<WatermarkProps>(() => {
    return {
        content: appStore.watermark || "Scpun Admin",
        cross: true,
        fullscreen: true,
        fontSize: 16,
        lineHeight: 16,
        width: 384,
        height: 384,
        xOffset: 12,
        yOffset: 60,
        rotate: -15,
        zIndex: 9999,
    };
});

// 系统语言
const appLocale = computed(() => {
    return appStore.storeLocale;
});
</script>

<template>
    <n-config-provider
        inline-theme-disabled
        :theme="themeStore.storeTheme"
        :theme-overrides="themeStore.storeThemeOverrides"
        :locale="appLocale.locale"
        :date-locale="appLocale.dateLocale"
        wh-full
    >
        <app-provider>
            <router-view />

            <n-watermark v-if="appStore.showWatermark" v-bind="watermarkProps" />
        </app-provider>
    </n-config-provider>
</template>
